package com.webermagem.DAO;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.webermagem.util.HibernateUtil;

public class LeitoDAO extends GenericDAO implements Serializable{
	

	private static final long serialVersionUID = 5453528151420262789L;

	public LeitoDAO(){
		
	}
	
	@SuppressWarnings("rawtypes")
	public List<?> listOrdenado(Session session, String parametroQuery) {
		
		if (session == null){
			session = HibernateUtil.getSessionFactory().openSession();
		}
		
		Transaction t = session.beginTransaction();
		List lista = session.createQuery(parametroQuery+" order by id").list();
		
		session.flush();
		
		t.commit();
		return lista;
	}

}
